package com.relational.mapping.Service.Impl;

import com.relational.mapping.Model.User;
import com.relational.mapping.Repository.UserRepository;
import com.relational.mapping.Service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Csea
 * @title
 * @date 2019/6/10 20:57
 */
@Service
public class UserserviceImpl implements UserService {
    @Autowired
    private UserRepository repository;

    @Override
    public User save(User user) {
        return repository.save(user);
    }

    @Override
    public User findById(Integer userId) {
        return repository.findById(userId).orElse(null);
    }

    @Override
    public void delete(Integer userId) {
        repository.deleteById(userId);
    }
}
